home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wildcat Files 2
/
The Wildcat Files 2 (Arsenal Computer).ISO
/
wildcat
/
publish.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1995-03-23
|
11KB
|
255 lines
unit Publish;
{$I WCDEFINE.INC}
interface
(**************************************************************************
Statistics/configuration & DB record structure for wcPRO version 4.10.
Copyright (c) 1991,95 Mustang Software Inc. All rights reserved.
Last Revised : 03/23/95
Revision : 'A'
Resonsibility: Sam Robertson
**************************************************************************)
uses
Dos,
Filer,
{$IFDEF OPRO}
OpDate,
OpString,
{$ELSE}
TpDate,
TpString,
{$ENDIF}
ProErr, {Error procs in here}
wcDB,
wcType;
const
StatHistoryName = 'PROSTAT.HIS';
BullHistoryName = 'PROSTAT.BUL';
QuesHistoryName = 'PROSTAT.QUE';
const
MaxNodes = 250;
type
TExtensions = record
Ext : String[3]; {Extension}
Viewer : DirStr; {Path and filename to viewer}
end;
type
PProConfig = ^TProConfig; {WCPRO.CFG}
TProConfig = record
WcProDir : DirStr; {Location of files}
Extensions : array [1..10] of TExtensions; {External viewers configuration}
Headers : Boolean; {Show headers?}
AppendMode : Boolean; {Append to existing files?}
IgnoreMaintenanceMode : Boolean; {Ignore status in NodeInfo.dat}
end;
type
TStat = (stUser, stFile);
type
{The following file is a BTREE Filer database, see implementation for}
{Key structure and initialization}
TStatRecord = record {PROSTAT.DAT/IX Contains top downloads/uploaders/downloaders}
Status : LongInt; {Filer record}
rtype : TStat; {Dictates type of record}
name : String[25]; {User name/FileName}
downloads : LongInt; {Total downloads}
uploads : LongInt; {Total uploads}
FileArea : Word; {Total file areas}
Filler : String[253]; {Filler space for future expansion}
end;
type {Used in PROSTAT.HIS}
TProLogOff = (ploNormal, ploDropCarrier, ploNoTime, ploAltMinus, ploNoActivity);
const
LogOffString : array[TProLogOff] of String[12] = ('Normal', 'Drop Carrier',
'No Time', 'Alt Minus',
'No Activity');
type
TAreaCodes = record
AC : Word; {Actual areacode number //SANITY HEADER for sort}
Val : LongInt; {Total number of calls from this AC}
end;
type
{The following file is stored using OPRO's stream IO routines for}
{upgradeability. If you wish to read this as a flat structure,}
{uncomment the status field}
PHistory = ^THistory; {PROSTAT.HIS}
THistory = record
{ StreamVersion : LongInt Only uncomment if reading as a standard file}
StartDate : DateTimeRec; {Start Date & time}
EndDate : DateTimeRec; {End Date & Time}
TotalCalls : array[0..MaxNodes] of LongInt; {Total calls by node number}
Minutes : array[0..MaxNodes] of LongInt; {Total minutes by node number}
Baud : array[TBaudType] of LongInt; {Total calls by baud rate}
BaudMNP : array[TBaudType] of LongInt; {Total calls but only Error Correcting connections}
WeekdayCount : array[DayType] of LongInt; {Total calls by day of week}
HourCount : array[0..23] of LongInt; {Total calls by hour of day}
Logoffs : array[TproLogOff] of LongInt; {Total logoffs/calls by how caller hung up}
Badnames : LongInt; {Total number of badnames}
WrongPasswords : LongInt; {Total wrong passwords}
NewUsers : LongInt; {Total new users}
Newsletter : LongInt; {Total times read newsletter}
BulletinsRead : LongInt; {Total bulletins read}
Questionnaires : LongInt; {Total Questionnaires}
PagedSysop : LongInt; {Total times sysop paged}
ReadFile : LongInt; {Total times files have been read}
MessagesLeft : LongInt; {Total messages left}
DoorsEntered : LongInt; {Total doors entered}
Uploads : array[TProtocol] of LongInt; {Total uploads by protocol}
Downloads : array[TProtocol] of LongInt; {Total downloads by protocol}
LeechMessage : LongInt; {Total download ratio warnings}
LeechReject : LongInt; {Total downloads rejected due to ratio}
TodayLeechCountReject : LongInt; {Count download rejections}
TodayLeechKbyteReject : LongInt; {KByte download rejections}
BirthdatePhone : LongInt; {Total wrong birthdates or Phone}
DownloadFailures : LongInt; {Total download failures}
BBSErrors : LongInt; {Total BBSErrors}
MaxConfAreas : Word; {Need this if conf number changes outside of PRO // SHOULD NOT BE EDITABLE}
AreaCodes : array[0..1000] of TAreaCodes; {Areacodes}
detects : array[TScrnDisplay] of Word; {Total calls by what WC detected}
end;
const
scUseHistory = $001;
scEraseLogs = $002;
scMessageTable = $004;
scDownloadGraph = $008;
scUploadGraph = $010;
scBaudGraph = $020;
scLogOffGraph = $040;
scCallsByDayGraph = $080;
scCallsbyHourGraph = $100;
scNodeTable = $200;
scGeneralStats = $400;
scAverageUser = $800;
scSysopStuff = $1000;
scCreateBaks = $2000;
type {*.PSC configuration files}
PStatConfig = ^TStatConfig;
TStatConfig = record
Nodes : TNodeInfoBits; {Nodes to process}
scFlags, {Flags}
BulletinTable, {Total bulletins to list}
QuestionnaireTable, {Total questionnaires to list}
DoorTable, {Total doors to list}
NumAcs, {Total AC's to list}
FileDownloads, {Total file downloads to list}
UserDownloads, {Total user downloads to list}
UserUploads : Word; {Total user uploads to list}
bbsfile, {Path to .BBS output file}
textfile, {Path to .TXT output file}
RIPfile : DirStr; {Path to .RIP output file}
MaxConfs : Word; {Sanity header/same as Makewild}
MaxFiles : Word; {" " " " "}
end;
{File if Variably size and contains the flags for the bitsets of conferences/
file areas to process}
{
In the questionnaire and bulletin directories there are prostat.bul and
prostat.que files which are simply files of longint for each bulletin.
}
const
StatUserNameKey = 1;
StatUserDownloadKey = 2;
StatUserUploadKey = 3;
StatFileNameKey = 1;
StatFileDownloadKey = 2;
type
{The statistics database descendant of TFileBlock from the wcDB.PAS unit}
TStatDatabase = object(TFileBlock)
constructor Init;
procedure GetCreateInfo(var Len : Word; var Keys : Integer; var IID : IsamIndDescr); virtual;
function BuildKey(const Data; Key : Integer) : IsamKeyStr; virtual;
procedure FatalDBError(const S : String); virtual;
procedure LogDBError(const S : String); virtual;
end;
function BuildStatFileNameKey(Name : String; Area : Word) : IsamKeyStr;
var
ProConfig : PProConfig;
implementation
constructor TStatDatabase.Init;
var
f : file;
Size : Word;
begin
if not inherited Init(ProConfig^.wcprodir+'PROSTAT',
False,
False,
StatUserNameKey,
SizeOf(TStatRecord)) then
Fail;
end;
procedure TStatDataBase.GetCreateInfo(var Len : Word;
var Keys : Integer;
var IID : IsamIndDescr);
begin
Len := SizeOf(TStatRecord);
Keys := 3;
IID[StatUserNameKey].KeyL := 30;
IID[StatUserNameKey].AllowDupK := False;
IID[StatUserDownloadKey].KeyL := 10;
IID[StatUserDownloadKey].AllowDupK := True;
IID[StatUserUploadKey].KeyL := 10;
IID[StatUserUploadKey].AllowDupK := True;
end;
function TStatDatabase.BuildKey(const Data; Key : Integer) : IsamKeyStr;
var
S : TStatRecord absolute Data;
begin
BuildKey := '';
case Key of
StatUserNameKey : if s.rtype = stUser then
BuildKey := Chr(Ord(StUser))+StUpCase(S.Name)
else
BuildKey := Chr(Ord(StFile))+StUpCase(S.Name)+Word2Key(S.FileArea);
StatUserDownloadKey : BuildKey := Long2Key(S.Downloads);
StatUserUploadKey : if s.rtype = stUser then
BuildKey := Long2Key(s.uploads);
else
FatalError('Invalid key number in StatDatabase. BuildKey: ' + Long2Str(Key));
end;
end;
function BuildStatFileNameKey(Name : String; Area : Word) : IsamKeyStr;
begin
BuildStatFileNameKey := Chr(Ord(StFile))+StUpCase(Name)+Word2Key(Area);
end;
procedure TStatDatabase.FatalDBError(const S : String);
begin
ProErr.LogBtreeError('PROSTAT DATABASE: '+S, IsamError);
end;
procedure TStatDatabase.LogDBError(const S : String);
begin
ProErr.LogError('PROSTAT DATABASE: '+S);
end;
end.